# Contributor: Jeff Bilyk <jbilyk at gmail>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=re2c
pkgver=3.1
pkgrel=0
pkgdesc="Lexer generator for C, C++ and Go"
url="http://www.re2c.org"
arch="all"
license="Public-Domain"
makedepends="python3"
subpackages="$pkgname-doc"
source="https://github.com/skvadrik/re2c/releases/download/$pkgver/re2c-$pkgver.tar.xz"

# secfixes:
#   1.3-r1:
#     - CVE-2020-11958

prepare() {
 	default_prepare
	update_config_sub
}

build() {
	CXXFLAGS="$CXXFLAGS -flto=auto" \
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
}

sha512sums="
649c5e103f8012e2717a0c36af135601dfa0a090c3e400bbf466537e7038ad73bc9e0ed36c3717b7c3c785c24ad024d40c7c31998325a14caf4984c4f19cd998  re2c-3.1.tar.xz
"
